from time import sleep
from selenium.webdriver.common.by import By
from base_page import BasePage

class BaiduNewsPage(BasePage):
    url = "https://news.baidu.com"
    __data1 = (By.CSS_SELECTOR, "#ww")
    __data2 = (By.CSS_SELECTOR, "#s_btn_wr")
    def open_baiduNewsPage(self):
        self.driver.get(self.url)

    def input_news(self, news):
        self.find_element(*self.__data1).send_keys(news)

    def click_searchBtn(self):
        self.find_element(*self.__data2).click()

    def search_news(self, news):
        self.open_baiduNewsPage()
        self.input_news(news)
        self.click_searchBtn()
        sleep(2)
